import { defineStore } from 'pinia'
import type { chatConfig } from '/@/stores/openai/interface'

export const useChatConfig = defineStore('chatConfig', {
    state: (): chatConfig => {
        return {
            chat: {
                // 模型
                model: 'gpt-3.5-turbo',
                // 随机性
                temperature: 0.6,
                // 频率_惩罚
                frequency_penalty: 0,
                // 存在_惩罚
                presence_penalty: 0,
                // 最大tokens
                max_tokens: 4000,
                // 限制上下文（历史记录）
                restriction: 26,
                restriction_value: true,
            },
            // 默认助手
            assistant: {
                name: 'AI助手',
                avatar: '/static/images/avatar.png',
                greeting: '你好，我是小助手，有什么可以帮助你的吗？',
            },
            model_list: [
                {
                    name: 'GPT-3.5 Turbo',
                    model: 'gpt-3.5-turbo',
                    icon: 'iconfont icon-ChatGPT',
                    type: 0,
                    max_token: 4000,
                }
            ]
        }
    },
    actions: {
        dataFill(state: any) {
            this.$state = { ...this.$state, ...state }
        }
    },
    persist: {
        key: 'chatConfig'
    }
})
